#include <bits/stdc++.h>

using namespace std;
 const int MAX_N = 1e6; // 假设我们需要计算到第1,000,000个正规数
  vector<long long> regularNumbers;
int main() {
  int n;
  cin >> n;
  regularNumbers.push_back(1);
  int i2 = 0, i3 = 0, i5 = 0;

  while (regularNumbers.size() < n) {
    long long next2 = regularNumbers[i2] * 2;
    long long next3 = regularNumbers[i3] * 3;
    long long next5 = regularNumbers[i5] * 5;

    long long next = min({next2, next3, next5});

    if (next == next2)
      i2++;
    if (next == next3)
      i3++;
    if (next == next5)
      i5++;

    if (next != regularNumbers.back()) {
      regularNumbers.push_back(next);
    }
  }

 

  cout << regularNumbers[n - 1] << endl;

  return 0;
}
